home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hyper Stacks 1994 May
/
Hyper Stacks (Pacific HiTech)(1994)[Mac].iso
/
HyperTalk
/
Groupies 3.2
/
card_2577.txt
< prev
next >
Wrap
Text File
|
1988-12-20
|
16KB
|
578 lines
-- card: 2577 from stack: in.2
-- bmap block id: 0
-- flags: 0000
-- background id: 5072
-- name:
-- part 136 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=23 top=4 right=25 bottom=490
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 14
-- style flags: 2048
-- line height: 18
-- part name:
-- part 21 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=217 top=153 right=175 bottom=332
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Card button
-- part 96 (button)
-- low flags: 00
-- high flags: 8002
-- rect: left=280 top=91 right=133 bottom=388
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Card button
-- part 97 (button)
-- low flags: 00
-- high flags: 8004
-- rect: left=66 top=170 right=201 bottom=184
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Card button
-- part 98 (field)
-- low flags: 01
-- high flags: 2002
-- rect: left=137 top=221 right=298 bottom=207
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 99 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=355 top=238 right=285 bottom=500
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 112 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=469 top=309 right=328 bottom=491
-- title width / last selected line: 0
-- icon id / first selected line: 16560 / 16560
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
go next
end mouseUp
-- part 113 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=21 top=309 right=328 bottom=43
-- title width / last selected line: 0
-- icon id / first selected line: 15420 / 15420
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
go prev
end mouseUp
-- part 161 (field)
-- low flags: 01
-- high flags: 2004
-- rect: left=11 top=6 right=129 bottom=83
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Groupies Field
----- HyperTalk script -----
-------------------------------------------------------------------
-- Groupies 3.0, a utility for grouping objects, by Sioux Lacy
-- This script is public domain. Happy grouping!
-- 04 May 1988 v2.1 revised for HyperCard version 1.2
-- 07 May 1988 v2.2 added ability to copy the text in fields
-- 01 June 1988 v2.3 revised to allow selection by dragging a rect
-- 22 July 1988 v3.0 added equal space feature, revised presentation
-- 01 Dec 1988 v3.2 revised
-- Many thanks to Bill Atkinson for his help and encouragement
-------------------------------------------------------------------
on NewField
global whereTheGroupIs
if whereTheGroupIs is not empty then
get Choice("Which do you wish to paste:","the Group","menuField")
if it is "the Group" then
DeleteMenuField
Paste
choose browse tool
exit NewField
end if
end if
ResetMenuField
choose browse tool
end NewField
on mouseUp
if the version < 1.2
then Abort "This utility requires HyperCard 1.2 or later."
put "Group,Move,Copy,Paste,Erase,Align,Adjust" into messages
put the userLevel into savedUserLevel
set the userLevel to 5
ResetMenuField
put 1 + (the clickV - top of me) div textHeight of me into clickLine
if line clickLine of me is not empty then
if clickLine is not 1 then CheckGroup
put "‚àö" into char 1 of line clickLine of me
do item clickLine of messages
ResetMenuField
end if
set the userLevel to savedUserLevel
end mouseUp
on ResetMenuField
put " Group" & return & " Move" & return & " Copy" & return & " Paste" & return & " Erase" & return & " Align" & return & " Adjust" into me
end ResetMenuField
---------------------------------------------------------------------
-- GROUPIES HANDLERS START HERE
---------------------------------------------------------------------
-- Message: Group
-- This will let the user designate a number of objects to be grouped
-- either by clicking on them, or showing a surrounding rectangle
on Group
global objectList, whereTheGroupIs
put "Objects" into selectMethod -- default method
if the optionKey is down then
put Choice("Group objects by selecting:", "Objects", "Area") into selectMethod
end if
if selectMethod is "Objects" then
Confirm "Click buttons or fields, then press command."
put empty into objectList
put empty into whereTheGroupIs
repeat until the commandKey is down
set cursor to arrow
if the mouseClick then
set cursor to watch
put HitTest(the clickLoc) into hitWhat
if hitWhat is not empty and hitWhat is not in objectList
then put hitWhat & "," after objectList
else beep -- invalid hit or nothing hit
end if
end repeat
else -- selectMethod is "Area"
Confirm "Use 2 clicks to show opposite corners of area."
put empty into objectList
put empty into whereTheGroupIs
set cursor to cross
wait until the mouseClick
put the clickLoc into selectRect
DrawMarker selectRect
wait until the mouseClick
put "," & the clickLoc after selectRect
DrawMarker the clickLoc
set cursor to watch
EraseMarkers
WithinRect selectRect
end if
delete last char of objectList -- get rid of trailing comma
choose browse tool
end Group
-- Message: Move
-- This will reposition (on the current card) all the
-- grouped objects.
-- They will follow the mouse location.
on Move
global objectList
CheckGroup
Confirm "Click and drag the group with mouse down."
set cursor to arrow
wait until the mouse is down
put the mouseLoc into thisLoc
repeat while the mouse is down
put thisLoc into lastLoc
put the mouseLoc into thisLoc
if thisLoc is not lastLoc then
put item 1 of thisLoc - item 1 of lastLoc into deltaX
put item 2 of thisLoc - item 2 of lastLoc into deltaY
lock screen
repeat with i = 1 to the number of items in objectList
put item i of objectList into object
get location of object
add deltaX to item 1 of it
add deltaY to item 2 of it
set location of object to it
end repeat
unlock screen
end if
end repeat
end Move
-- Message: Copy
-- This will remember, in a global variable, the current card. Then,
-- when the user 'pastes', the objects will be copied from that card.
on Copy
global whereTheGroupIs, savedUserLevel
CheckGroup
put the userLevel into savedUserLevel
set the userLevel to 5 -- will be restored after 'Paste'
Confirm "Go wherever you wish and 'Paste'."
put the long id of this card into WhereTheGroupIs
end Copy
-- Message: Paste
-- This will paste all the objects in the group into the current card /
-- background. It must be preceded by 'Copy'.
on Paste
global objectList, WhereTheGroupIs, savedUserLevel
CheckGroup
if WhereTheGroupIs is empty
then Abort "Please choose 'Copy' before 'Paste'."
set cursor to watch
set lockMessages to true
lock screen
repeat with i = 1 to the number of items in objectList
push this card
go to WhereTheGroupIs
put item i of objectList into object
if word 2 of object is "field"
then put the value of object into copyOfText
select object
type "C" with commandKey
pop card
set editBkgnd to (word 1 of object = "bkgnd")
type "V" with commandKey
if word 2 of object is "field" then
if word 1 of object is "bkgnd"
then put copyOfText into bkgnd field (the number of bkgnd fields)
else put copyOfText into card field (the number of card fields)
end if
end repeat
choose browse tool
unlock screen
set the userLevel to savedUserLevel
Prompt "These new objects are not grouped. The old group is still valid."
end Paste
-- Message: Erase
-- This will delete all the objects in the group. They are removed
-- from the stack, and the operation is not undoable.
on Erase
global objectList, WhereTheGroupIs
CheckGroup
Confirm "Deleting group is not undoable. Are you sure?"
repeat with i = the number of items in objectList down to 1
select item i of objectList
type "X" with commandKey
end repeat
put empty into objectList
put empty into WhereTheGroupIs
choose browse tool
end Erase
-- Message: Align
-- This will line up the objects flush left, right, top or bottom,
-- depending on the user's wishes.
on Align
global objectList
CheckGroup
put Choice("Adjust members by moving them:","Left/Right","Up/Down") into axis
if axis is "Up/Down"
then answer "Align objects at:" with "Top" or "Bottom" or "Center"
else answer "Align objects at:" with "Left" or "Right" or "Center"
put it into alignment
Confirm "Click where you wish them to align."
set cursor to cross
wait until the mouseClick
if alignment is "Center" then
repeat with i = 1 to the number of items in objectList
put item i of objectList into object
get location of object
if axis is "Up/Down"
then put the clickV into item 2 of it
else put the clickH into item 1 of it
set location of object to it
end repeat
else
repeat with i = 1 to the number of items in objectList
put item i of objectList into object
if axis is "Up/Down" then
if alignment is "Top"
then set top of object to the clickV
else set bottom of object to the clickV
else if axis is "Left/Right" then
if alignment is "Left"
then set left of object to the clickH
else set right of object to the clickH
end if
end repeat
end if
end Align
-- Message: Adjust
-- This will put an equal amount of 'white' space between consecutive
-- objects in the group. Note that the objects must be in ascending
-- order for this to work as expected.
on Adjust
global objectList
CheckGroup
put Choice("Adjust space between objects:","Horizontally","Vertically") into adjust
Confirm "Use 2 clicks to show desired spacing."
set cursor to cross
wait until the mouseClick
put the clickLoc into startLoc
DrawMarker startLoc
wait until the mouseClick
put the clickLoc into endLoc
DrawMarker endLoc
SortGroup adjust
if adjust = "Horizontally" then
put abs(item 1 of endLoc - item 1 of startLoc) into horizSpace
put right of item 1 of objectList into lastRight
repeat with i = 2 to the number of items in objectList
put item i of objectList into object
set left of object to lastRight + horizSpace
put right of object into lastRight
end repeat
else -- adjust "Vertically"
put abs(item 2 of endLoc - item 2 of startLoc) into vertSpace
put bottom of item 1 of objectList into lastBottom
repeat with i = 2 to the number of items in objectList
put item i of objectList into object
set top of object to lastBottom + vertSpace
put bottom of object into lastBottom
end repeat
end if
EraseMarkers
end Adjust
-------------------------------------------------------------
on Abort what
answer what
exit to HyperCard
end Abort
on CheckGroup
global objectList
if objectList is empty then Abort "There are no objects in the group."
end CheckGroup
function Choice prompt, choice1, choice2
answer prompt with choice1 or choice2 or "Cancel"
if it is "Cancel" then exit to HyperCard
return it
end Choice
on Confirm what
answer what with "Cancel" or "OK"
if it is "Cancel" then exit to HyperCard
end Confirm
on DrawMarker where
lock screen
doMenu "New Button"
put the number of card btns into newBtn
set icon of card btn newBtn to "Marker Cross"
set style of card btn newBtn to transparent
set showName of card btn newBtn to false
set rect of card btn newBtn to 0,0,20,20
set loc of card btn newBtn to where
set name of card btn newBtn to empty
choose browse tool
unlock screen
end DrawMarker
on EraseMarkers
lock screen
select card btn (the number of card btns)
doMenu "Clear Button"
select card btn (the number of card btns)
doMenu "Clear Button"
choose browse tool
unlock screen
end EraseMarkers
function HitTest where
repeat with i = the number of card buttons down to 1
if where is within rect of card button i then
if visible of card button i
then return "card button id " & the id of card button i
end if
end repeat
repeat with i = the number of card fields down to 1
if where is within rect of card field i then
if visible of card field i
then return "card field id " & the id of card field i
end if
end repeat
repeat with i = the number of bkgnd buttons down to 1
if where is within rect of bkgnd button i then
if visible of bkgnd button i
then return "bkgnd button id " & the id of bkgnd button i
end if
end repeat
repeat with i = the number of bkgnd fields down to 1
if where is within rect of bkgnd field i then
if visible of bkgnd field i
then return "bkgnd field id " & the id of bkgnd field i
end if
end repeat
return empty
end HitTest
on Prompt what
put what
put the seconds into startTime
put the mouseLoc into startLoc
wait until (the seconds = startTime+10) or (the mouseLoc <>¬ startLoc)
put empty into message box
hide message box
end Prompt
on SortGroup how
global objectList
put empty into sortedList
if how is "Vertically" then put true into verticalSort
else put false into verticalSort
repeat with i = 1 to the number of items in objectList
put false into inserted
if verticalSort then get top of item i of objectList
else get left of item i of objectList
repeat with j = 1 to the number of items in sortedList
if (verticalSort and (it < top of item j of sortedList)) or (not verticalSort and (it < left of item j of sortedList)) then
put item i of objectList & "," before item j of sortedList
put true into inserted
exit repeat
end if
end repeat
if inserted is false then put item i of objectList & "," after sortedList
end repeat
delete last char of sortedList
put sortedList into objectList
end SortGroup
on WithinRect selectRect
global objectList
repeat with i = the number of card buttons down to 1
if the loc of card button i is within selectRect then
if visible of card button i
then put "card button id " & the id of card button i & "," after objectList
end if
end repeat
repeat with i = the number of card fields down to 1
if the loc of card field i is within selectRect then
if visible of card field i
then put "card field id " & the id of card field i & "," after objectList
end if
end repeat
repeat with i = the number of bkgnd buttons down to 1
if the loc of bkgnd button i is within selectRect then
if visible of bkgnd button i
then put "bkgnd button id " & the id of bkgnd button i & "," after objectList
end if
end repeat
repeat with i = the number of bkgnd fields down to 1
if the loc of bkgnd field i is within selectRect then
if visible of bkgnd field i
then put "bkgnd field id " & the id of bkgnd field i & "," after objectList
end if
end repeat
end WithinRect
-- part contents for card part 98
----- text -----
card field with
text
-- part contents for card part 99
----- text -----
card field
with text
-- part contents for background part 11
----- text -----
bkgnd field
with
text
-- part contents for card part 136
----- text -----
Try out Groupies with these Objects...
-- part contents for card part 161
----- text -----
Group
Move
Copy
Paste
Erase
Align
Adjust